<div class="row">
	<div class="col-md-12">
		<h1>Sản phẩm <small>Quản lý các Sản phẩm</small></h1>
		<ol class="breadcrumb">
            <li><a href="<?php echo admin_page_url(); ?>"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="<?php echo admin_page_url(PRODUCT_SLUG); ?>"><i class="fa fa-table"></i> Sản phẩm</a></li>
        </ol>
    </div>
</div>

<div class="row">
    <div class="col-md-6 col-xs-12">
        <form method="get" action="<?php echo admin_page_url(PRODUCT_SLUG.'/tim-kiem'); ?>" enctype="multipart/form-data">
            <div class="input-group">
                <input type="text" class="form-control" name="s" value="<?php echo isset($searchkey)?$searchkey:''; ?>" placeholder="Tìm kiếm sản phẩm" />
                <span class="input-group-btn">
                    <button class="btn btn-success" type="submit"><i class="fa fa-search"></i> Tìm kiếm!</button>
                </span>
            </div>
            <!-- /input-group -->
        </form>
    </div>
    <div class="clearfix"></div>

    <div class="col-md-12 col-xs-12 mgt10 mgr5">
        <?php echo $pagingBar; ?>
    </div>
    <div class="clearfix"></div>

    <div class="col-md-12 col-xs-12 mgt10">
        <form method="post" action="<?php echo admin_page_url(PRODUCT_SLUG.'/cap-nhat-nhanh'); ?>">
            <div class="table-responsive">
                <table class="table table-bordered table-hover tablesorter item-list">
                    <thead>
                        <tr>
                            <th class="header"># <i class="fa fa-sort"></i></th>
                            <th class="header">Ảnh sản phẩm</th>
                            <th class="header">Sản phẩm <i class="fa fa-sort"></i></th>
                            <th class="header">Gian hàng / Danh mục <i class="fa fa-sort"></i></th>
                            <th class="header">&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach($aProduct as $index=>$product) { ?>
                        <tr class="can-edit" data-id="<?php echo $this->encrypt->encode($product->product_id); ?>">
                            <th class="header bg-info"><?php echo $index+1; ?></th>
                            <td class="col-xs-12 col-md-1">
                                <div class="media">
                                    <?php
                                        $isHasImg = false;
                                        if($product->getImage()!='' && image_exist('public/'.$product->shop_image_folder.'/'. PRODUCT_IMAGE_URL . $product->getImage())){
                                            $isHasImg = true;
                                        }
                                    ?>
                                    <?php if($isHasImg) { ?>
                                    <a class="thumbnail fancybox" href="<?php echo product_upload($product->getImage(), $product->shop_image_folder, false); ?>">
                                        <img class="media-object minW-96" src="<?php echo product_upload($product->getImage(), $product->shop_image_folder); ?>" />
                                    </a>
                                    <?php } else { ?>
                                        <a class="thumbnail clearMgr" href="#">
                                            <img class="has-border" data-src="holder.js/96x96/text:Hình đại diện" />
                                        </a>
                                    <?php } ?>
                                </div>
                                <p class="text-center clearMgr">
                                    <a target="_blank" class="btn btn-success product-slug" data-slug="<?php echo $product->product_slug; ?>" href="<?php echo product_url($product->product_slug); ?>">
                                        <i class="fa fa-external-link"></i> Xem
                                    </a>
                                </p>
                            </td>
                            <td class="input-product">
                                <h4><a class="product-title strong big-title" href="<?php echo admin_product_single_url($product->product_slug); ?>"><?php echo $product->product_title; ?></a></h4>
                                <p class="strong">[<?php echo $product->getCode(); ?>]</p>
                                <p class="normal-price-style"><?php echo currency_format($product->getPriceNew()); ?></p>
                                <p class="normal-old-price-style"><?php echo currency_format($product->getPriceOld()); ?></p>
                                <p><em><?php echo fdate_format($product->product_created_at); ?></em></p>
                            </td>
                            <td class="input-product-cate">
                                <h4>
                                    <a target="_blank" class="shop-cate strong big-title" data-id="<?php echo $product->category_id; ?>" href="<?php echo shop_url($product->shop_slug); ?>">
                                        <?php echo $product->shop_title; ?>
                                    </a>
                                </h4>
                                <h4>
                                    <a class="clear-decoration" href="<?php echo admin_category_url($product->category_slug); ?>">
                                        <label class="label label-danger">
                                            <?php echo $product->category_title; ?>
                                        </label>
                                    </a>
                                </h4>
                            </td>
                            <td class="input-product-flg">
                                <div class="checkbox inline-table clearMgr">
                                    <input id='chk-home-<?php echo $product->product_id; ?>' class="input-product-home-flg lb-toggle" data-name="home_flg" type="checkbox"
                                        <?php if($product->home_flg==ON) { echo "checked='checked'"; } ?>
                                    />Trang chủ
                                    <label for="chk-home-<?php echo $product->product_id; ?>" class="mgr10"></label>
                                </div>
                                <div class="checkbox inline-table clearMgr">
                                    <input id="chk-hili-<?php echo $product->product_id; ?>" class="input-product-hili-flg lb-toggle" data-name="highlight_flg" type="checkbox"
                                        <?php if($product->product_highlight_flg==ON) { echo "checked='checked'"; } ?>
                                    />SP Hot
                                    <label for="chk-hili-<?php echo $product->product_id; ?>" class="mgr10"></label>
                                </div>
                                <br />
                                <div class="checkbox inline-table clearMgr">
                                    <input id="chk-active-<?php echo $product->product_id; ?>" class="input-product-active-flg lb-toggle" data-name="active_flg" type="checkbox"
                                        <?php if($product->product_active_flg==ON) { echo "checked='checked'"; } ?>
                                    />Hiển thị
                                    <label for="chk-active-<?php echo $product->product_id; ?>" class="mgr10"></label>
                                </div>
                                <div class="checkbox inline-table clearMgr">
                                    <input id='chk-delete-<?php echo $product->product_id; ?>' class="input-product-delete-flg lb-toggle red" data-name="delete_flg" type="checkbox"
                                        <?php if($product->product_deleted_at!='') { echo "checked='checked'"; } ?>
                                    />Xoá
                                    <label for="chk-delete-<?php echo $product->product_id; ?>"></label>
                                </div>
                            </td>
                        </tr>
                        <?php } ?>
                    </tbody>
                </table>
            </div>
        </form>
    </div>
    <div class="clearfix"></div>
</div>